package com.ww.scm.valueObject.croe;

import java.util.HashMap;
import java.util.Map;

import com.ww.core.utils.mapper.JsonMapper;

public class ResponseInfo {

	protected Map<String,Object> datasetMap=new HashMap<String,Object>();
	protected Map<String,Object> responseMap=new HashMap<String,Object>();
	protected Map<String,Object> dateMap=new HashMap<String,Object>();

	
	public ResponseInfo() {	
		dateMap.put("response", responseMap);
		datasetMap.put("dataset", dateMap);
		
		responseMap.put("content", "操作成功。");
		responseMap.put("success", "true");
	}
	
	public ResponseInfo(boolean success,String content) {	
		dateMap.put("response", responseMap);
		datasetMap.put("dataset", dateMap);
		
		responseMap.put("content", content);
		responseMap.put("success", String.valueOf(success));
	}
	
	public void setResponse(String content,boolean success){
		dateMap.put("content", content);
		dateMap.put("success", String.valueOf(success));
	}

	public void setResponseContent(String content){
		dateMap.put("content", content);
	}
	
	public void setResponseSuccess(boolean success){
		dateMap.put("success", success);
	}

	public String toJson(){
		return JsonMapper.buildNormalBinder().toJson(datasetMap);
	}
}
